package com.zlx.guguanjia.mapper;

import com.zlx.guguanjia.entity.SysOffice;
import com.zlx.guguanjia.mapper.provider.SysOfficeSqlProvider;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;
import java.util.Map;

@org.apache.ibatis.annotations.Mapper
public interface SysOfficeMapper extends Mapper<SysOffice> {
    @SelectProvider( type= SysOfficeSqlProvider.class,method = "selectAll")
    List<SysOffice> selectPage(Map<String,Object> map);

    @Select("SELECT  " +
            "  sof.*   " +
            "FROM  " +
            "  sys_role_office sro,  " +
            "  sys_office sof   " +
            "WHERE  " +
            "  sro.role_id = #{rid}   " +
            "  AND sof.del_flag = 0   " +
            "  AND sro.office_id = sof.id")
    List<SysOffice> selectByRid(long rid);
}